package com.lagou.web.controller;

import com.lagou.filter.component.IpAddressThreadLocal;
import com.lagou.web.service.HelloService;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/hello")
public class HelloController {

  @Autowired
  private HelloService helloService;

  @RequestMapping("/sayHello")
  public String sayHello(HttpServletRequest request) {
    IpAddressThreadLocal.getInstance().setIpAddress(request.getRemoteAddr());
    helloService.sayHello();
    return "hello dubbo";
  }

}
